package com.zhj.bean;

/**
 * @author zhj
 */
public class Stock {
    // 库存
    private static int num = 5;

    // 减少库存
    public boolean reduceStock() {
        if (num > 0) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            num--;
            return true;
        } else {
            return false;
        }
    }
}
